package com.md.base.exception;

import com.md.base.EnumBase;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 刘骄阳
 * 2022-09-23 23:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor(staticName = "of")
public class ErrorMessage implements EnumBase {
  private Integer code;
  private String message;

  public static ErrorMessage of(final EnumBase base, final Object... obj) {
    return ErrorMessage.of(base.getCode(), String.format(base.getMessage(), obj));
  }
}

